package com.group9.handinhand.service.so;

import org.apache.commons.lang.ArrayUtils;

import com.group9.handinhand.dao.model.CommunityMember;
/**
 * Class for Service of community member
 *
 */
public class CommunityMemberSO extends AbstractBaseSO {
	
    private CommunitySO community;
	private UserSO user;
	/**
	 * converts the community member model object
	 * @param ignoreProperties
	 * @return
	 */
	public CommunityMember convertToModelObject(String... ignoreProperties) {
		CommunityMember model = (CommunityMember) convert(new CommunityMember(),
				(String[]) ArrayUtils.addAll(ignoreProperties,new String[]{"community","user"}));
		model.setUser(this.user.convertToModelObject());
		model.setCommunity(this.community.convertToModelObject(new String[]{"moderators", "posts", "events","requests","offers","members"}));
		return model;
	}

	public CommunitySO getCommunity() {
		return community;
	}

	public void setCommunity(CommunitySO community) {
		this.community = community;
	}

	public UserSO getUser() {
		return user;
	}

	public void setUser(UserSO user) {
		this.user = user;
	}
	/**
	 * to string method
	 */
	@Override
	public String toString() {
		return "CommunityMemberSO [community=" + community + ", user=" + user
				+ "]";
	}
	
	
}
